from jili.calc import calcor_base
import numpy as np
class Wide(calcor_base):
    def __init__(self,ta_arg={}):
        self.out = ["wide"]
        self.input = ["high","low"]
        self.parameters = {"timeperiod":6}
        super().__init__(ta_arg)
        self.batch=self.parameters["timeperiod"]
        self.lookback = self.batch - 1
    def calc(self):
        h = self.hisbars[self.input[0]].max()
        l = self.hisbars[self.input[1]].min()
        return 100*(h-l)/l